package ${mapperPackageName}.test;
import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import ${mapperPackageName}.${className}Mapper;
import ${packageName}.${className};

@RunWith(SpringJUnit4ClassRunner.class) // 使用junit4进行测试
@ContextConfiguration("classpath:spring/applicationContext-dao.xml") // 加载配置文件
public class ${className}MapperTest {
@Autowired
private ${className}Mapper ${className?uncap_first}Mapper;

@Test
public void testInsert() {
${className} ${className?uncap_first} = new ${className}();
// set something
${className?uncap_first}Mapper.insert(${className?uncap_first});
}

@Test
public void testDeleteByPrimaryKey() {
${className?uncap_first}Mapper.deleteByPrimaryKey(1L);
}

@Test
public void testUpdateByPrimaryKey() {
${className} ${className?uncap_first} = ${className?uncap_first}Mapper.selectByPrimaryKey(2L);
// ${className?uncap_first}.set ..
${className?uncap_first}Mapper.updateByPrimaryKey(${className?uncap_first});
}

@Test
public void testCountAll() {
int count = ${className?uncap_first}Mapper.countAll();
System.out.println(count);
}

@Test
public void testSelectByPrimaryKey() {
${className} ${className?uncap_first} = ${className?uncap_first}Mapper.selectByPrimaryKey(2L);
System.out.println(${className?uncap_first});
}

@Test
public void testSelectAll() {
List<${className}> list = ${className?uncap_first}Mapper.selectAll();
for (${className} ${className?uncap_first} : list) {
System.out.println(${className?uncap_first});
}
}

@Test
public void testSelectBySelective() {
${className} condition = new ${className}();
// set something
List<${className}> list = ${className?uncap_first}Mapper.selectBySelective(condition);
for (${className} ${className?uncap_first} : list) {
System.out.println(${className?uncap_first});
}
}

}
